// 获取原始的push 和 replace
import VueRouter from 'vue-router'
var originPush = VueRouter.prototype.push
var originReplace = VueRouter.prototype.replace
// 重写原型方法push
VueRouter.prototype.push = function (location, res, rej) {
  if (res && rej) {
    originPush.call(this, location, res, rej)
  } else {
    originPush.call(this, location, () => {}, () => {})
  }
}
// 重写原型方法replace
VueRouter.prototype.replace = function (location, res, rej) {
  if (res && rej) {
    originReplace.call(this, location, res, rej)
  } else {
    originReplace.call(this, location, () => {}, () => {})
  }
}
